{% extends 'preheat/base.html' %}

{% block title %}CDN域名管理 - CDN预热平台{% endblock %}

{% block page_title %}CDN域名列表{% endblock %}

{% block content %}
<div class="mb-4">
    <a href="{% url 'preheat:cdn_domain_create' %}" class="btn btn-primary">添加CDN域名</a>
</div>

<div class="card">
    <div class="card-header">
        <h3>CDN域名清单</h3>
    </div>
    <div class="card-body">
        {% if domains %}
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>CDN域名</th>
                        <th>厂商</th>
                        <th>归属项目</th>
                        <th>创建时间</th>
                        <th>更新时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for domain in domains %}
                    <tr>
                        <td>{{ domain.domain }}</td>
                        <td>{{ domain.get_vendor_display }}</td>
                        <td>{{ domain.project }}</td>
                        <td>{{ domain.created_time|date:'Y-m-d H:i:s' }}</td>
                        <td>{{ domain.updated_time|date:'Y-m-d H:i:s' }}</td>
                        <td>
                            <a href="{% url 'preheat:cdn_domain_delete' domain.id %}" class="btn btn-danger btn-sm" onclick="return confirm('确定要删除该CDN域名吗？')">删除</a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% else %}
        <p class="text-center text-muted">暂无CDN域名数据，请点击"添加CDN域名"按钮添加域名。</p>
        {% endif %}
    </div>
</div>
{% endblock %}